﻿using Orchard.ContentManagement.Records;
using Morgma.Infographics.Enums;
using Morgma.Infographics.Extensions;

namespace Morgma.Infographics.Models {
	public class GoogleInfographicsSettingsPartRecord : ContentPartRecord {
		/// <summary>
		/// Gets or sets the Google Analytics tracking key used to perform analytics tracking.
		/// </summary>
		public virtual string GoogleInfographicsApiUrl { get; set; }

		/// <summary>
		/// Height of the image to be rendered
		/// </summary>
		public virtual int ImageHeight { get; set; }
		
		/// <summary>
		/// Width of the image to be rendered
		/// </summary>
		public virtual int ImageWidth { get; set; }

		/// <summary>
		/// Specifies that we want a QR code
		/// </summary>
		/// <value>Default value is <c>true</c>.</value>
		public virtual bool GetQRCode { get; set; }

		/// <summary>
		/// Supports UTF-8, Shift_JIS, or ISO-8859-1
		/// </summary>
		public virtual string OutputEncoding { get; set; }

		/// <summary>
		/// Four possible levels of data loss recovery L(lowest and default) = 7% -> H(highest) = 30%
		/// </summary>
		public virtual string ErrorCorrectionLevel{ get; set; }

		/// <summary>
		/// Whitespace around the data portion of a QR code
		/// </summary>
		public virtual int Margin { get; set; }

		/// <summary>
		/// Initializes a new instance of the <see cref="GoogleAnalyticsSettingsPartRecord"/> class. Sets the default value
		/// of <see cref="P:UseAsyncTracking"/> to <c>true</c> and <see cref="P:TrackOnAdmin"/> to <c>false</c>.
		/// </summary>
		public GoogleInfographicsSettingsPartRecord() {
			GoogleInfographicsApiUrl = "https://chart.googleapis.com/chart";
			GetQRCode = true;
			ImageHeight = 150;
			ImageWidth = 150;
			OutputEncoding = Enums.OutputEncoding.UTF_8.GetStringValueAttribute();
			Margin = 4;
			ErrorCorrectionLevel = Enums.ErrorCorrectionLevel.H.ToString();
		}
	}
}